<?
$this->addCSSArray(array('left_block.css'));
$this->includeHeader();
$City			= &$this->GetPageElement('CITY');
$Weather	= &$this->GetPageElement('WEATHER');
$months = array('01' => 'января', '02' => 'февраля', '03' => 'марта', '04' => 'апреля', '05' => 'мая', '06' => 'июня', '07' => 'июля', '08' => 'авгутса', '09' => 'сентября', '10' => 'октября', '11' => 'ноября', '12' => 'ноября');
$week		= array('вс', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб');
$NT = 'NIGHT';$H = (int)date('H');
$s = 's';
if ($H >= 0 && $H < 6) {$NT = 'NIGHT';$s = 'n';}
elseif ($H >= 6 && $H < 12) {$NT = 'MORNING';}
elseif ($H >= 12 && $H < 18) {$NT = 'DAY';}
else {$NT = 'EVENING';}
$Date = new DateTime();
?>
<table width="100%" height="100%" cellpadding="0" cellspacing="0">
<tr>
	<td width="190" valign="top">
		<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#e6f0f6" class="black12">
		<tr>
			<td width="7" height="7"><img src="/system/templates/default/images/w5_1.png" width="7" height="7"></td>
			<td></td>
			<td width="7"><img src="/system/templates/default/images/w5_2.png" width="7" height="7"></td>
		</tr>
		<tr>
			<td></td>
			<td valign="top">
				<?$W = &$Weather[0];
				preg_match('#([0-9]+)-([0-9]+)-([0-9]+)#', $W['DATE'], $match);
				$Date->setDate($match[1], $match[2], $match[3]);?>
				<table id="weatherBlock">
				<tr><td colspan="3" ><strong class="blueTT"><?=$City['NAME']?></strong></a><div class="line"></div></td></tr>
				<tr valign="top">
					<td width="55" style="padding-right:5px"><img src="/images/icons/<?echo $s,'.',$W[$NT.'_CLOUDY'],'.',$W[$NT.'_RAIN'],'.',$W[$NT.'_PHEN']?>.png"  alt="<?echo $this->Language->CLOUDYArray[$W[$NT.'_CLOUDY']],($W[$NT.'_RAIN'] != 0)?','.$this->Language->RAINArray[$W[$NT.'_RAIN']]:'',($W[$NT.'PHEN'] != 0)?','.$this->Language->PHENArray[$W[$NT.'PHEN']]:''?>" /></td>
					<td width="75" style="padding-right:5px"><span class="temperature"><?=(($W[$NT.'_T'] > 0)?'+':'').$W[$NT.'_T']?> <span class="cels">°C</span></span></td>
					<td>
						<div class="weather"><span class="value"><?=$W[$NT.'_S_WIND']?></span><span class="unit"> м/с</span></div>
						<div class="weather"><span class="value"><?=$W[$NT.'_P']?></span><span class="unit"> мм рт.ст.</span></div>
						<div class="weather"><span class="value"><?=$W[$NT.'_WET']?></span><span class="unit"> % влажн.</span></div>
					</td>
				</tr>
				<tr><td colspan="3"><span class="opis"><?echo $this->Language->CLOUDYArray[$W[$NT.'_CLOUDY']],($W[$NT.'_RAIN'] != 0)?','.$this->Language->RAINArray[$W[$NT.'_RAIN']]:'',($W[$NT.'_PHEN'] != 0)?','.$this->Language->PHENArray[$W[$NT.'_PHEN']]:''?></span><div class="line"></div></td></tr>
				<tr><td colspan="3"><span class="blue14T"><? echo$this->Language->TimesArray[$NT],', ',$week[$Date->format('w')],' ',$match[3], ' ', $months[$match[2]]?></span></td></tr>
				</table>
			</td>
			<td></td>
		</tr>
		<tr>
			<td height="7"><img src="/system/templates/default/images/w5_3.png" width="7" height="7"></td>
			<td></td>
			<td><img src="/system/templates/default/images/w5_4.png" width="7" height="7"></td>
		</tr>
		</table>
	</td>
	<td valign="top" style="padding-left:15px; padding-bottom:15px">
		<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#e6f0f6" class="black12">
		<tr bgcolor="#FFFF88">
			<td width="7" valign="top" bgcolor="#f9cf58"><img src="/system/templates/default/images/w5_1.png" width="7" height="7"></td>
			<td height="25" colspan="3" bgcolor="#f9cf58"><h1><?=$City['PAGE_H1']?></h1></td>
			<td width="7" valign="top" bgcolor="#f9cf58"><img src="/system/templates/default/images/w5_2.png" width="7" height="7"></td>
		</tr>
		<tr><td height="1" colspan="5" background="/system/templates/default/images/line_2.gif"></td></tr>
		<tr>
			<td height="25"></td>
			<td colspan="3" valign="top" style="padding-top:7px">
				<table width="100%" cellpadding="0" cellspacing="0" class="black12">
				<tr>
					<?
					if (is_null($City['PAGE_IMAGE'])) {echo '';}
					else {echo '<td width="50" valign="top" style="padding-right:10px"><img src="/images/gerbs/',$City['PAGE_IMAGE'],'"></td>';}
					?>
					<td valign="top">
						<?if (is_array($this->crumbs)) {
							echo '<p class="gray11">';
							foreach ($this->crumbs as $HREF => $TEXT) {
								if ($HREF != '') {
								echo '<a href="',$HREF,'">',$TEXT,'</a> -> ';
								} else {echo $TEXT;}
							}
							echo '</p>';
						}
						echo $City['PAGE_TEXT'];
						?>
					</td>
				</tr>
				<tr>
					<td colspan="2" style="padding-top:10px">
						<?if (!is_null($Weather)) {
							$Today = $Date->format('Y-m-d');
							$Date->add(new DateInterval('P1D'));
							$Tomorrow = $Date->format('Y-m-d');
							$wind		= array(0 => 'wind_sv.png', 1 => 'wind_sv.png', 2 => 'wind_yv.png', 3 => 'wind_yz.png', 4 => 'wind_sz.png', 5 => 'wind_noth.gif', 6 => 'wind_east.gif', 7 => 'wind_south.gif', 8 => 'wind_west.gif', 9 => 'wind_0.gif');
							foreach ($Weather as $W) {
								preg_match('#([0-9]+)-([0-9]+)-([0-9]+)#', $W['DATE'], $match);
								$Date->setDate($match[1], $match[2], $match[3]);
								echo '<div class="small">
								<table width="600" cellpadding="0" cellspacing="0" bgcolor="#4379f2" class="black12">
								<tr>
									<td width="7" height="7" bgcolor="#FDECB9"><img src="/system/templates/default/images/wb_1.png" width="7" height="7"></td>
									<td bgcolor="#FDECB9"></td>
									<td colspan="7" bgcolor="#FFFFFF"></td>
									<td width="7" align="center" bgcolor="#FFFFFF"><img src="/system/templates/default/images/wb_2.png" width="7" height="7"></td>
								</tr>
								<tr>
									<td rowspan="2" bgcolor="#FDECB9">&nbsp;</td>
									<td width="90" rowspan="2" bgcolor="#FDECB9" class="',($Date->format('w') == '0' || $Date->format('w') == '6')?'red14T':'blue14T', '">',
										($Today == $W['DATE'])?'сегодня<br>':($Tomorrow == $W['DATE']?'завтра<br>':''),
										$match[3], ' ',$months[$match[2]],', ',$week[$Date->format('w')],
									'</td>';
									if ($W['NIGHT_P'] != 0 && $W['NIGHT_WET'] != 0) {
										echo '<td width="65" rowspan="2" align="center" bgcolor="#FFFFFF"><img src="/system/templates/default/images/icons/n.',$W['NIGHT_CLOUDY'],'.',$W['NIGHT_RAIN'],'.',($W['NIGHT_PHEN'] > 0)?1:0,'.png" width="55" height="55"></td>
										<td height="5" colspan="2" bgcolor="#FFFFFF" class="blue12T">ночь</td>
										<td width="1" rowspan="2" valign="top" background="/system/templates/default/images/line_3.gif" bgcolor="#FFFFFF"><img src="/system/templates/default/images/line_3.gif" width="1" height="5"></td>';
									} else {echo '<td bgcolor="#FFFFFF" rowspan="2">&nbsp;</td><td bgcolor="#FFFFFF" colspan="2">&nbsp;</td><td bgcolor="#FFFFFF" rowspan="2">&nbsp;</td>';}
									if ($W['DAY_P'] != 0 && $W['DAY_WET'] != 0) {
										echo '<td width="65" rowspan="2" align="center" bgcolor="#FFFFFF"><img src="/system/templates/default/images/icons/s.',$W['DAY_CLOUDY'],'.',$W['DAY_RAIN'],'.',($W['DAY_PHEN']> 0)?1:0,'.png" width="55" height="55"></td>
										<td colspan="2" bgcolor="#FFFFFF" class="blue12T">день</td>
										<td align="center" bgcolor="#FFFFFF">&nbsp;</td>';
									} else {echo '<td bgcolor="#FFFFFF" rowspan="2">&nbsp;</td><td bgcolor="#FFFFFF" colspan="2">&nbsp;</td><td bgcolor="#FFFFFF" rowspan="2">&nbsp;</td>';}
								echo '</tr>
								<tr>';
									if ($W['NIGHT_P'] != 0 && $W['NIGHT_WET'] != 0) {
										echo '<td width="120" bgcolor="#FFFFFF">',
											($W['NIGHT_CLOUDY'] != 0)?$this->Language->CLOUDYArray[$W['NIGHT_CLOUDY']]:'',
											($W['NIGHT_RAIN'] != 0)?', '.$this->Language->RAINArray[$W['NIGHT_RAIN']]:'', 
											($W['NIGHT_PHEN'] != 0)?', '.$this->Language->PHENArray[$W['NIGHT_PHEN']]:'',
										'</td>
										<td align="center" bgcolor="#FFFFFF" class="blueTT">',($W['NIGHT_T'] > 0)?'+':'',$W['NIGHT_T'],'</td>';
									} else {echo '<td bgcolor="#FFFFFF">&nbsp;</td><td bgcolor="#FFFFFF">&nbsp;</td>';}
									if ($W['DAY_P'] != 0 && $W['DAY_WET'] != 0) {
										echo '<td width="120" bgcolor="#FFFFFF">',
											($W['DAY_CLOUDY'] != 0)?$this->Language->CLOUDYArray[$W['DAY_CLOUDY']]:'',
											($W['DAY_RAIN'] != 0)?', '.$this->Language->RAINArray[$W['DAY_RAIN']]:'', 
											($W['DAY_PHEN'] != 0)?', '.$this->Language->PHENArray[$W['DAY_PHEN']]:'',
										'</td>
										<td align="center" bgcolor="#FFFFFF" class="blueTT">',($W['DAY_T'] > 0)?'+':'',$W['DAY_T'],'</td>
										<td align="center" bgcolor="#FFFFFF">&nbsp;</td>';
									} else {echo '<td bgcolor="#FFFFFF">&nbsp;</td><td bgcolor="#FFFFFF">&nbsp;</td>';}
								echo '</tr>
								<tr>
									<td height="7" bgcolor="#FDECB9"><img src="/system/templates/default/images/wb_3.png" width="7" height="7"></td>
									<td bgcolor="#FDECB9"></td>
									<td colspan="7" bgcolor="#FFFFFF"></td>
									<td align="center" bgcolor="#FFFFFF"><img src="/system/templates/default/images/wb_4.png" width="7" height="7"></td>
								</tr>
								</table>
								<br />
								</div>
								<div class="full">
								<table width="600" cellpadding="0" cellspacing="0" bgcolor="#4379f2" class="black12">
								<tr>
									<td width="7" height="7" bgcolor="#FDECB9"><img src="/system/templates/default/images/wb_1.png" width="7" height="7"></td>
									<td colspan="8" bgcolor="#FDECB9"></td>
									<td width="7" align="center" bgcolor="#FDECB9"><img src="/system/templates/default/images/wb_2.png" width="7" height="7"></td>
								</tr>
								<tr>
									<td bgcolor="#FDECB9">&nbsp;</td>
									<td width="90" height="38" valign="top" bgcolor="#FDECB9" class="',($Date->format('w') == '0' || $Date->format('w') == '6')?'red14T':'blue14T', '">',
										($Today == $W['DATE'])?'сегодня<br>':($Tomorrow == $W['DATE']?'завтра<br>':''),
										$match[3], ' ',$months[$match[2]],', ',$week[$Date->format('w')],
									'</td>
									<td colspan="2" valign="top" bgcolor="#FDECB9">Характеристика погоды,<br>атмосферные явления </td>
									<td width="100" align="center" valign="top" bgcolor="#FDECB9">Tемпература<br>воздуха, °C</td>
									<td width="80" align="center" valign="top" bgcolor="#FDECB9">Атм. давл.,<br>мм рт. ст.</td>
									<td colspan="2" align="center" valign="top" bgcolor="#FDECB9">Ветер,<br>м/с</td>
									<td width="80" align="center" valign="top" bgcolor="#FDECB9">Влажность<br>воздуха, %</td>
									<td align="center" bgcolor="#FDECB9">&nbsp;</td>
								</tr>';
								foreach ($this->Language->TimesArray as $Index => $Time) {
									if ($W[$Index.'_P'] == 0 && $W[$Index.'_WET'] == 0) {continue;}
									$s = ($Index == 'NIGHT')?'n.':'s.';
									echo '<tr><td height="1" colspan="10" background="/system/templates/default/images/line_2.gif" bgcolor="#FFFFFF"></td></tr>
									<tr>
										<td bgcolor="#FFFFFF">&nbsp;</td>
										<td bgcolor="#FFFFFF" class="blue14T">',$Time, '</td>
										<td width="65" height="60" align="center" bgcolor="#FFFFFF"><img src="/system/templates/default/images/icons/',$s,$W[$Index.'_CLOUDY'],'.',$W[$Index.'_RAIN'],'.',($W[$Index.'_PHEN'] > 0)?1:0,'.png" width="55" height="55"></td>
										<td width="100" bgcolor="#FFFFFF">',
										($W[$Index.'_CLOUDY'] != 0)?$this->Language->CLOUDYArray[$W[$Index.'_CLOUDY']]:'',
										($W[$Index.'_RAIN'] != 0)?', '.$this->Language->RAINArray[$W[$Index.'_RAIN']]:'', 
										($W[$Index.'_PHEN'] != 0)?', '.$this->Language->PHENArray[$W[$Index.'_PHEN']]:'',
										'</td>
										<td align="center" bgcolor="#FFFFFF" class="blueTT">',($W[$Index.'_T'] > 0)?'+':'',$W[$Index.'_T'],'</td>
										<td align="center" bgcolor="#FFFFFF">',$W[$Index.'_P'], '</td>
										<td align="center" bgcolor="#FFFFFF"><img src="/system/templates/default/images/icons/',$wind[$W[$Index.'_D_WIND']],'" width="17" height="19"><br>',$this->Language->D_WINDArray[$W[$Index.'_D_WIND']],'</td>
										<td align="center" bgcolor="#FFFFFF">',$W[$Index.'_S_WIND'],'</td>
										<td align="center" bgcolor="#FFFFFF">',$W[$Index.'_WET'],'</td>
										<td align="center" bgcolor="#FFFFFF">&nbsp;</td>
									</tr>';
								}
								echo '<tr>
										<td height="7" bgcolor="#FFFFFF"><img src="/system/templates/default/images/wb_3.png" width="7" height="7"></td>
										<td colspan="8" bgcolor="#FFFFFF"></td>
										<td align="center" bgcolor="#FFFFFF"><img src="/system/templates/default/images/wb_4.png" width="7" height="7"></td>
								</tr>
								</table><br />
								</div>';
							}
						}?>
						<script type="text/javascript"> 
						$(document).ready(function(){
							$("div.small:first").hide().toggleClass("active");
							$("div.full:first").show();
							$("div.small").click(function(){
								$("div.small.active").next().slideToggle(300);
								$("div.small.active").show().toggleClass("active");
								$(this).hide().toggleClass("active");
								$(this).next().slideToggle(500);
							});
						});
						</script>
					</td>
				</tr>
				</table>
			</td>
			<td></td>
		</tr>
		<tr>
			<td height="7"><img src="/system/templates/default/images/w5_3.png" width="7" height="7"></td>
			<td></td>
			<td></td>
			<td></td>
			<td><img src="/system/templates/default/images/w5_4.png" width="7" height="7"></td>
		</tr>
		</table>
	</td>
</tr>
</table>
<?$this->includeFooter();?>